Skip to content

Build from git#4961

Open
jvulgan wants to merge 2 commits into
mainfrom
build-from-git
Open

Build from git#4961
jvulgan wants to merge 2 commits into
mainfrom
build-from-git

Conversation

@jvulgan

@jvulgan jvulgan commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Add support for building packages from git-based sdists and document the new configuration field.

New Features:

  • Allow onboarded packages to specify a git-based source distribution URL that is used instead of PyPI when identifying build artifacts.
  • Onboard the griffe package using the new git-based source configuration.

Documentation:

  • Document the optional sdist_url field in onboarded package metadata and how it influences package identification.

Add optional sdist_url field to onboarded_packages JSON schema so
packages can be built from arbitrary git sources instead of PyPI
sdists. When present, identify-packages outputs PEP 440 URL
requirements (e.g. "pkg @ git+url@version") that fromager already
supports. Also fixes word-splitting in the build_extra loop and
hardens dedup grep with -F for literal matching.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds support for building onboarded packages directly from git-sourced sdists by extending the package metadata schema and updating identify-packages to emit PEP 440 URL requirements, and onboards the griffe package using this mechanism.

Flow diagram for git-sourced sdist handling in identify-packages

flowchart LR
    A[onboarded_packages JSON
    fields: name, version, ignored_versions, build_extra, sdist_url] --> B[identify-packages]

    B --> C{sdist_url present?}
    C -- Yes --> D[Emit PEP 440 URL requirement
    pkg @ sdist_url@version]
    C -- No --> E[Emit standard requirement
    pkg==version]

    D --> F[Build pipeline
    fetch from git URL]
    E --> F

    G[griffe.json
    uses sdist_url git URL] --> B
Loading

File-Level Changes

Change Details Files
Extend onboarded package metadata to support git-based sdist sources and wire this through identify-packages.
  • Document new optional sdist_url field in CLAUDE.md, describing its purpose and expected git URL format.
  • Update identify-packages script to read sdist_url from onboarded package JSONs when present.
  • Modify requirement generation logic to emit PEP 440 URL requirements of the form pkg @ url@version when sdist_url is set instead of using the default PyPI source.
CLAUDE.md
hack/identify-packages
Onboard the griffe package using the new git-based build mechanism.
  • Add onboarded_packages/griffe.json describing griffe’s version and git-based sdist source.
  • Ensure griffe’s metadata conforms to the extended schema including optional sdist_url.
onboarded_packages/griffe.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The description of sdist_url in CLAUDE.md could briefly clarify how the @version portion of the generated PEP 440 requirement is derived (e.g., tag vs. commit hash) and what happens if the git URL already contains a ref.
  • In identify-packages, consider validating sdist_url values more strictly (e.g., ensure they are git URLs and produce clear errors for malformed inputs) before constructing the PEP 440 URL requirement.
  • It may be helpful for future maintainers if identify-packages logs or annotates when a package is being resolved from sdist_url rather than PyPI, so the source of truth is obvious during debugging.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The description of `sdist_url` in CLAUDE.md could briefly clarify how the `@version` portion of the generated PEP 440 requirement is derived (e.g., tag vs. commit hash) and what happens if the git URL already contains a ref.
- In `identify-packages`, consider validating `sdist_url` values more strictly (e.g., ensure they are git URLs and produce clear errors for malformed inputs) before constructing the PEP 440 URL requirement.
- It may be helpful for future maintainers if `identify-packages` logs or annotates when a package is being resolved from `sdist_url` rather than PyPI, so the source of truth is obvious during debugging.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Take sdist from git because the one on pypi has dangling symlink which
results in errors like:
[Errno 2] No such file or directory: '/var/workdir/output/work-dir/griffe-2.1.0/griffe-2.1.0/docs/logo.svg'
@jvulgan

jvulgan commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@calungaproject/developers ptal. notice girffe built successfully when building directly from git as opposed to failing with the wrong symlinks in #4213 and #1741 (and other packages which tried to build it as dep)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant